.\"--------------------------------------------------------------------
.\" Ds - start indented display
.\" De - end indented display
.\"--------------------------------------------------------------------
.de Ds
.nf
'in +0.5i
..
.de De
'in
.fi
..
.TH MOST 1 "May 1999"
.SH NAME
most \- browse or page through a text file
.SH SYNOPSIS
.B most
.RB [ \-1bCcdMstuvwz ]
.RB [ +\fIlineno\fB ]
.RB [ +c ]
.RB [ +d ]
.RB [ +s ]
.RB [ +u ]
.RB [ +/\fIstring\fB ]
.RI [ filename ...]
.SH DESCRIPTION
.I most
is a paging program that displays,
one windowful at a time,
the contents of a file on a terminal.
It pauses after each windowful and prints on the window status line
the screen the file name, current line number,
and the percentage of the file so far displayed.
.PP
Unlike other paging programs,
.I most
is capable of displaying an arbitrary number of windows
as long as each window occupies at least two screen lines.
Each window may contain the same file or a different file.
In addition, each window has its own mode.
For example, one window may display a file with its lines wrapped while
another may be truncating the lines.
Windows may be `locked'
together in the sense that if one of the locked windows scrolls,
all locked windows will scroll.
.I most
is also capable of ignoring lines
that are indented beyond a user specified value.
This is useful when viewing computer programs to pick out
gross features of the code.
See the
.RB ` :o '
command for a description of this feature.
.PP
In addition to displaying ordinary text files,
.I most
can also display binary files as well as files with arbitrary ascii
characters.
When a file is read into a buffer,
.I most
examines the first 32 bytes of
the file to determine if the file is a binary file and then switches
to the appropriate mode.
However, this feature may be disabled with the
.B \-k
option.
See the description of the
.BR \-b ,
.BR \-k ,
.BR \-v ,
and
.B \-t
options for further details.
.PP
Text files may contain combinations of underscore and backspace
characters causing a printer to underline or overstrike.
When
.I most
recognizes this,
it inserts the appropriate escape sequences to
achieve the desired effect.
In addition,
some files cause the printer to overstrike some characters
by embedding carriage return characters in the middle of a line.
When this occurs,
.I most
displays the overstruck character with a bold
attribute.
This feature facilitates the reading of
UNIX
man pages or a document produced by
.IR runoff .
In particular,
viewing this document with
.I most
should illustrate this behavior provided that the
underline characters have not been stripped.
This may be turned off with the
.B \-v
option.
.PP
By default, lines with more characters than the terminal width are
not wrapped but are instead truncated.
When truncation occurs, this
is indicated by a `$' in the far right column of the terminal
screen.
The RIGHT and LEFT arrow keys may be used to view lines
which extend past the margins of the screen.
The
.B \-w
option may be used to override this feature.
When a window is wrapped,
the character `\e' will appear at the right edge of the window.
.PP
Commands are listed below.
.SH OPTIONS
.TP
.B \-1
VT100 mode.  This is meaningful only on VMS systems.  This option should be
used if the terminal is strictly a VT100.  This implies that the terminal
does not have the ability to delete and insert multiple lines.  VT102s and
above have this ability.
.TP
.B \-b
Binary mode.
Use this switch when you want to view files
containing 8 bit characters.
.I most
will display the file 16 bytes per line in hexadecimal notation.
A typical line looks like:
.IP
.Ds
01000000 40001575 9C23A020 4000168D     ....@..u.#. @...
.De
.IP
When used with the
.B \-v
option, the same line looks like:
.IP
.Ds
^A^@^@^@  @^@^U u 9C #A0    @^@^V8D     ....@..u.#. @...
.De
.\".TP
.\".B \-k
.\"`Kanji' option.
.\"Ordinarily,
.\".I most
.\"will go into binary mode if the file consists of non-ascii characters.
.\"Sometimes this feature is not desirable since some
.\"terminals have a special interpretation for eight bit
.\"characters.
.\"The
.\".B \-k
.\"option turns off the automatic sensing.
.TP
.B \-C
Disable color support.
.TP
.B \-d
Omit the backslash mark used to denote a wrapped line.
.TP
.B \-M
Disable the use of mmap.
.TP
.B \-s
Squeeze.
Replace multiple blank lines with a single blank line.
.TP
.B \-z
option turns off gunzip-on-the-fly.
.TP
.B \-v
Display control characters as in `^A' for control A.
Normally
.I most
does not interpret control characters.
.TP
.B \-t
Display tabs as `^I'.
This option is meaningful only when used with the
.B \-v
option.
.TP
.BI + lineno
Start up at
.IR lineno .
.TP
.B \-c
Make searches case sensitive.
By default, they are not.
.TP 
.B \-u
Disable UTF-8 mode even if the locale dictates it.
.TP
.B +u
Force UTF-8 mode.  By default most will use the current locale to
determine if UTF-8 mode should be used.  The
.B +u
and
.B \-u
switches allow the behavior to be overridden.
.TP
.B +d
This switch should only be used if you want the option to
delete a file while viewing it.
This makes it easier to
clean unwanted files out of a directory.
The file is
deleted with the interactive key sequence
.RB ` :D '
and then confirming with
.RB ` y '.
.TP
.BI +/ string
Start up at the line containing the first occurrence of
.IR string .
.SH "COMMAND USAGE"
Some commands have an optional numeric argument
.I id
,entered before the command.   If not given, the
default value of 
.I i
is 1.
.PP
Commands  take effect immediately; typing a 
.I RETURN
after isn't necessary or correct.  (Besides,
.I RETURN
itself is a command.)
.PP
Example: to go down one line, press the
.I DOWN_ARROW
key. To go down 20 lines, press 
.I 2
then 
.I 0
then the
.I DOWN_ARROW
key.
.TP
\fBRETURN\fR, \fBDOWN_ARROW\fR, \fBV\fR, \fBCTRL-N\fR
Display another line, or
.I i
more lines, if specified.
.TP
.BR UP_ARROW ", " ^ ", " CTRL-P
Display previous line, or
.I i
previous lines, if specified.
.TP
.BR T ", " ESCAPE <
Move to top of buffer.
.TP
.BR B ", " ESCAPE >
Move to bottom of buffer.
.TP
.BR RIGHT_ARROW ", " TAB ", " >
Scroll window left
.RI 60 i
columns to view lines that are beyond the right margin of the window.
.TP
.BR LEFT_ARROW ", " CTRL-B ", " <
Scroll window right
.RI 60 i
columns to view lines that are beyond the left margin of the window.
.TP
\fBU\fR, \fBCTRL-U\fR, \fBDELETE\fR, \fBPREV_SCREEN\fR
Skip back
.I i
windowfuls and then print a windowful.
.TP
.BR R ", " CTRL-R
Redraw the window.
.TP
.BR J ", " G
If
.I i
is not specified, then prompt for a line number then jump to that line
otherwise just jump to line
.IR i .
.TP
.B %
If
.I i
is not specified, then prompt for a
percent number then jump to that percent of the
file otherwise just jump to
.I i
percent of the file.
.TP
.BR W ", " w
If the current screen width is 80, make it 132 and vice-versa.
For other values, this command is ignored.
.TP
\fBQ\fR, \fBCTRL-X CTRL-C\fR, \fBCTRL-K E\fR
Exit from
.IR most .
On VMS, ^Z also exits.
.TP
.BR h ", " CTRL-H ", " HELP ", " PF2
Help.
Give a description of all the
.I most
commands.
The
.I most
environment variable
.B MOST_HELP
must be set for this to be meaningful.
.TP
\fBf\fR, \fB/\fR, \fBCTRL-F\fR, \fBFIND\fR, \fBGOLD PF3\fR
Prompt for a string and search forward from the
current line for
.IR i th
distinct line containing the string.
.B CTRL-G
aborts.
.TP
.B ?
Prompt for a string and search backward for the
.IR i th
distinct line containing the string.
.B CTRL-G
aborts.
.TP
.B n
Search for the next
.I i
lines containing an occurrence of the last search string in the
direction of the previous search.
.\"-------
.\" The '@' causes problems when included in a paragraph tag
.\" in my system's -man macro set, so jump though some hoops to
.\" avoid doing this.
.\"-------
.PP
\fBm\fR, \fBSELECT\fR, \fBCTRL-@\fR, \fBCTRL-K M\fR, \fBPERIOD\fR
.PD 0
.IP
.PD
Set a mark on the current line for later reference.
.TP
.BR "INSERT_HERE" ", " "CTRL-X CTRL-X" ", " "COMMA" ", " "CTRL-K RETURN" ", " "GOLD PERIOD"
Set a mark on the current line but return to previous mark.
This allows the user to toggle back and forth between two positions
in the file.
.TP
.BR l ", " L
Toggle locking for this window.
The window is locked if there is a `*' at the left edge
of the status line.
Windows locked together, scroll together.
.TP
.BR "CTRL-X 2" ", " "CTRL-W 2" ", " "GOLD X"
Split this window in half.
.TP
.BR "CTRL-X o" ", " "CTRL-W o" ", " o ", " "GOLD UP" ", " "GOLD DOWN"
Move to other window.
.TP
.BR "CTRL-X 0" ", " "CTRL-W 0" ", " "GOLD V"
Delete this window.
.TP
.BR "CTRL-X 1" ", " "CTRL-W 1" ", " "GOLD O"
Delete all other windows, leaving only one window.
.TP
.BR E ", " e
Edit this file.
.TP
.BR $ ", " "ESC $"
This is system dependent.
On VMS, this causes
.I most
to spawn a subprocess.
When the user exits the process,
.I most
is resumed.
On
UNIX
systems,
.I most
simply suspends itself.
.TP
.B :n
Skip to the next filename given in the command line.
Use the arrow keys to scroll forward or backward
through the file list.
.RB ` Q '
quits
.I most
and any other key selects the given file.
.TP
.B :c
Toggle case sensitive search.
.TP
.B :D
Delete current file.
This command is only meaningful with the
.B +d
switch.
.TP
.BR :o ", " :O
Toggle various options.
With this key sequence,
.I most
displays a prompt asking the user to hit
one of:
.BR bdtvw .
The
.RB ` b ',
.RB ` t ',
.RB ` v ',
and
.RB ` w '
options have the same meaning as the command
line switches.
For example, the
.RB ` w '
option will toggle wrapping on and off for the current window.
.IP
The
.RB ` d '
option must be used with a prefix integer
.IR i .
All lines indented beyond
.I i
columns will not be displayed.
For example, consider the fragment:
.IP
.Ds
.ne 11
int main(int argc, char **argv)
{
	int i;

	for (i = 0; i < argc, i++)
	{
		fprintf(stdout,"%i: %s\en",i,argv[i]);
	}
	return 0;
}
.De
.IP
The key sequence
.RB ` 1:od '
will cause
.I most
to display the file ignoring all lines indented beyond the first column.
So for the example above,
.I most
would display:
.IP
.Ds
.ne 2
int main(int argc, char **argv)...
}
.De
.IP
where the `...' indicates lines follow are not displayed.
.SH HINTS
.B CTRL-G
aborts the commands requiring the user to type something
in at a prompt.
The backquote key has a special meaning here.
It is used to quote certain characters.
This is useful when search for
the occurrence of a string with a control character or a string at
the beginning of a line.
In the latter case, to find the occurrence
of `The' at the beginning of a line, enter
.B `^JThe
where
.B `
quotes the
.BR CTRL-J .
.SH ENVIRONMENT
.I most
uses the following environment variables:
.TP
.B MOST_SWITCHES
This variable sets commonly used switches.
For example,
some people prefer to use
.I most
with the
.B \-s
option so that excess blank lines are not displayed.
On VMS this is normally done done in the login.com through the line:
.IP
.Ds
$ define MOST_SWITCHES "-s"
.De
.TP
.BR MOST_EDITOR ", " SLANG_EDITOR
Either of these environment variables specify an editor for
.I most
to invoke to edit a file. The value can contain %s and %d formatting
descriptors that represent the file name and line number,
respectively.  For example, if JED is your editor, then set
.B MOST_EDITOR 
to 'jed %s -g %d'.
.TP
.B MOST_HELP
This variable may be used to specify an alternate help file.
.TP
.B MOST_INITFILE
Set this variable to specify the initialization file to load during
startup.  The default action is to load the system configuration file
from
.I /etc/most.conf
and then a personal configuration file located at
.I $HOME/.mostrc
.
.SH CONFIGURATION FILE SYNTAX
When
.I most
starts up, it tries to read a system configuration file and
then a personal configuration file.  These files may be used to
specify keybindings and colors.
.PP
To bind a key to a particular function use the syntax:
.PP
.B    setkey  function-name  key-sequence
.PP
The
.I setkey
command requires two arguments.  The
.I function-name
argument specifies the function that is to be executed as a response
to the keys specified by the
.I key-sequence
argument are pressed.  For example,
.PP
      setkey   "up"     "^P"
.PP
indicates that when
.I Ctrl-P
is pressed then the function
.I up
is to be executed.  
.PP
Sometimes, it is necessary to first unbind a key-sequence before
rebinding it in order via the
.I unsetkey
function:
.PP
       unsetkey "^F"
.PP
Colors may be defined through the use of the
.I color
keyword in the configuration file using the syntax:
.PP
.B     color OBJECT-NAME FOREGROUND-COLOR BACKGROUND-COLOR
.PP    
Here, OBJECT-NAME can be any one of the following items:

.nf
    status           -- the status line
    underline        -- underlined text
    overstrike       -- overstriked text
    normal           -- anything else
.fi

See the sample configuration files for more information.
.SH BUGS
Almost all of the known bugs or limitations of
.I most
are due to a desire to read and interpret control characters in files.
One problem concerns the use of backspace characters to underscore or
overstrike other characters.
.I most
makes an attempt to use terminal
escape sequences to simulate this behavior.
One side effect is the
one does not always get what one expects when scrolling right and
left through a file.
When in doubt, use the
.B \-v
and
.B \-b
options of
.IR most .
.PP
.SH AUTHOR
John E. Davis
.br
davis@space.mit.edu
.SH ACKNOWLEDGEMENTS
I would like to thank the users of
.I most
for valuable comments and criticisms.
I would especially like to thank those individuals
who have contributed code to
.IR most .
.PP
Mats Akerberg, Henk D. Davids, Rex O. Livingston, and Mark
Pizzolato contributed to the early VMS versions of
.IR most .
In particular, Mark worked on it to get it ready for DECUS.
.PP
Foteos Macrides <MACRIDES@SCI.WFEB.EDU> adapted 
.IR most 
for use in
.IR cswing 
and
.IR gopher .
A few features of the present version of
.IR most
was inspired from his work.
.PP
I am grateful to Robert Mills <robert@jna.com.au> for re-writing the search
routines to use regular expressions.  
.PP
Sven Oliver Moll <smol0075@rz.uni-hildesheim.de> came up with the idea of
automatic detection of zipped files.
.PP
I would also like to thank Shinichi Hama for his valuable criticisms of
.IR most .
.PP
Javier Kohen was instrumental in the support for UTF-8.
.PP
Thanks to David W. Sanderson (dws@cs.wisc.edu) for adapting the
documentation to nroff man page source format.

